https://leetcode.cn/problems/final-value-of-variable-after-performing-operations/submissions/671972559/

class Solution {
public:
	int finalValueAfterOperations(vector<string>& operations) {
		int len=operations.size();
		int ans=0;
		for(auto c:operations[0]){
			if(c>='0'&&c<='9'){
				ans=(int)(c-'0');
			}
		}
		for(int i=0;i<len;i++){
			if(operations[i][1]=='+'){
				ans++;
			}
			else if(operations[i][1]=='-'){
				ans--;
			}
		}
		return ans;
	}
};
